<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p{
            font-weight: bold;
            font-size: 20px;
        }
        .box1{
            width: 200px;
            height: 20px;
            border: 2px solid #c92007;
        }
        #box{
            width: 0;
            height: 20px;
            background: #c92007;
        }
    </style>
</head>
<body>
<p>进 度 条</p>
<div class="box1">
    <div id="box"></div>
</div>
<span id="con">0%</span>


    <script>
//         使用定时器实现进度条, 
//    提示:  获取标签对象, 并改变style属性的width值
    // var proBar = document.getElementById("progressBar");
	// proBar.style.width = barW + "px"; 
        var oBox=document.getElementById("box");
        var oCon=document.getElementById("con");

        var num=0;
        timer=setInterval(function() {
            num++;
            oBox.style.width=num+"px";
            var res=parseInt(num/2);
            oCon.innerHTML=res+"%";
            if(num>=200){
                clearInterval(timer);
            }
        },50);

    </script>
</body>
</html>